import logging

from redis import StrictRedis


class Config(object):
    """工程配置"""
    LOG_LEVEL = logging.DEBUG
    SECRET_KEY = "itheima"
    """连接mysql数据库配置"""
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/information"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_COMMIT_ON_TEARDOWM = True
    """配置redis"""
    redis_host = "127.0.0.1"
    redis_port = 6379
    SESSION_TYPE = "redis"
    SESSION_USE_SIGNER = True
    SESSION_REDIS = StrictRedis(host=redis_host, port=redis_port)
    PERMANENT_SESSION_LIFETIME = 3600 * 3600


class DevelopementConfig(Config):
    """开发模式下面"""
    DEBUG = True


class ProductionConfig(Config):
    """生产模式下"""
    LOG_LEVEL = logging.ERROR


config = {
    "development": DevelopementConfig,
    "production": ProductionConfig
}
